<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<section class="content-header">
    <h1>
        项目变更通知列表
    </h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" >
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目编号</label>
                                    <input type="text" name="proCode" class="form-control"  placeholder="请输出项目编号">
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目名称</label>
                                    <input type="text" name="proName" class="form-control"  placeholder="请输入项目名称">
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>项目状态</label>
                                    <select name="proCancelMark"  type="value" class="form-control" autocomplete="off">
                                        <option value="" style="text-align: center" selected>请选择</option>
                                        <option value="0" style="text-align: center" >正常</option>
                                        <option value="1" style="text-align: center">取消</option>
                                    </select>
                                </div>
                                <div class="form-group" style="margin-right: 10px;">
                                    <label>变更日期</label>
                                    <input type="text" class="form-control datepicker" name="startCreateDate"
                                           placeholder="请选择">
                                    <span>至</span>
                                    <input type="text" class="form-control datepicker" name="endCreateDate"
                                           placeholder="请选择">
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search"
                                        style="margin-top: 5px;">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table class="table table-bordered" id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer">
</div>
<script th:inline="javascript">
    var table;
    $(function () {
        /** 加载用户表格 */
        table = js.table.init({
            url: ctx + "projectChange/infoList",
            columns: [
                {
                    title: '序号', field: 'proInvId', width: '50',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                { title: "项目编号", field: 'proCode', width: '100'},
                { title: "项目名称", field: 'proName', width: '135',
                    formatter: function (value, row, index) {
                        if (value == null) {
                            return '';
                        } else {
                            return value;
                        }
                    }
                },
                { title: "项目名称说明", field: 'proNameDesp', width: '130',
                    formatter: function (value, row, index) {
                        if (value == null) {
                            return '';
                        } else {
                            return value;
                        }
                    }
                },
                { title: "数量", field: 'proQty', width: '80' ,
                    formatter: function (value, row, index) {
                        if (value == null) {
                            return '';
                        } else {
                            return value;
                        }
                    }
                },
                { title: "需方", field: 'customer',width:'130' ,
                    formatter: function (value, row, index) {
                        if (value == null) {
                            return '';
                        } else {
                            return value;
                        }
                    }
                },
                { title: "安装地点", field: 'insSite', width: '130' ,
                    formatter: function (value, row, index) {
                        if (value == null) {
                            return '';
                        } else {
                            return value;
                        }
                    }
                },
                { title: "项目状态", field: 'proCancelMark', width: '80',
                    formatter: function (value, row, index, field) {
                        if(value === 0){
                            return '<span class="badge ' + ["label-success"] + '">' + '正常' + '</span> ';
                        } else if (value === 1) {
                            return '<span class="badge ' + ["label-danger"] + '">' + '取消' + '</span> ';
                        }else {
                            return '';
                        }
                    }
                },
                { title: "变更日期", field: 'chgCteateDate',width: '100',
                    formatter: function (value, row, index, field) {
                        if(value == null){
                            return '';
                        }else {
                            return value;
                        }
                    }
                },
                { title: "询价单名称", field: 'preEnqName',width: '130',
                    formatter: function (value, row, index, field) {
                        if(value == null){
                            return '';
                        }else {
                            return value;
                        }
                    }
                },
                { title: "通知处理</br>状态", field: 'chgInfoStatus',width: '80',
                    formatter: function (value, row, index, field) {
                        if(value === 1){
                            return '<span class="badge ' + ["label-warning"] + '">' + '未处理' + '</span> ';
                        }else if(value === 2 || value === 3) {
                            return '<span class="badge ' + ["label-success"] + '">' + '已处理' + '</span> ';
                        }else {
                            return '';
                        }
                    }
                },
                {
                    title: "操作", width: '120', formatter: function (value, row, index) {
                        var actions = [];
                            actions.push('<a class="btn btn-info btn-xs" href="' + ctx + 'projectChange/chgInfo/viewInfo/' + row.proChangeId + '" target="_blank" >查看</a> ');
                        return actions.join('');
                    }
                }
            ]
        });

        /**
         * 表格搜索
         */
        $("#btn-search").click(function () {
            js.table.search(table);
        });
    })
</script>